package cn.wolfcode.wolf2w.util;

import lombok.Getter;
import lombok.Setter;

/**
 * 约定keyde 管理类
 */
@Getter
public enum  KeyManager {

    VERIFY_CODE("verify_code",Consts.VERIFY_CODE_VAI_TIME*60L),
    USER_INFO_TOKEN("user_info_token",Consts.USER_INFO_TOKEN_VAI_TIME*60L),
    STRATEGY_STATIS_VO("strategy_statis_vo",-1L),
    STRATEGY_STATIS_FAVOR("strategy_statis_favor",-1L),
    STRATEGY_STATIS_THUMBUP("strategy_statis_thumbup",-1L);

    @Setter
    private String prifix;  //前缀
    @Setter
    private Long time;    //失效时间


     KeyManager(String prifix,Long time){  //带参构造器
        this.prifix= prifix;
        this.time = time;
    }

    //拼接完整的rediskey
    public String join(String... values){

        StringBuilder sb = new StringBuilder(80);
        sb.append(this.prifix);
        for (String value : values) {
            sb.append(":").append(value);
        }

        return sb.toString();
    }
}
